package com.original.simuladores.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.original.simuladores.entities.Task;
import com.original.simuladores.service.TaxIndexService;

@RestController
public class TestController {
	@Autowired
	TaxIndexService taxIndexService;
	@RequestMapping(value = "/tasks", method = RequestMethod.GET, headers = "Accept=application/json")
	public List<Task> getAllTasks() {
		List<Task> tasks = new ArrayList<Task>();
		Task task = new Task();
		task.setTask_id(1);
		task.setTask_name("1");
		task.setTask_status("COMPLETED");
		task.setTask_priority("HIGH");
		tasks.add(task);
		task = new Task();
		task.setTask_id(2);
		task.setTask_name("2");
		task.setTask_status("COMPLETED");
		task.setTask_priority("HIGH");
		tasks.add(task);
		return tasks;
	}

	@RequestMapping(value = "/tasks/archive/{taskIds}", method = RequestMethod.POST, headers = "Accept=application/json")
	public List<Task> archiveAllTasks(@PathVariable int[] taskIds) {
		List<Task> tasks = new ArrayList<Task>();
		Task task = new Task();
		task.setTask_id(3);
		task.setTask_name("3");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		task = new Task();
		task.setTask_id(4);
		task.setTask_name("4");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		return tasks;
	}

	@RequestMapping(value = "/tasks/{taskId}/{taskStatus}", method = RequestMethod.POST, headers = "Accept=application/json")
	public List<Task> changeTaskStatus(@PathVariable int taskId,
			@PathVariable String taskStatus) {
		List<Task> tasks = new ArrayList<Task>();
		Task task = new Task();
		task.setTask_id(5);
		task.setTask_name("5");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		task = new Task();
		task.setTask_id(6);
		task.setTask_name("6");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		return tasks;
	}

	@RequestMapping(value = "/tasks/insert/{taskName}/{taskDesc}/{taskPriority}/{taskStatus}", method = RequestMethod.POST, headers = "Accept=application/json")
	public List<Task> addTask(@PathVariable String taskName,
			@PathVariable String taskDesc, @PathVariable String taskPriority,
			@PathVariable String taskStatus) {
		List<Task> tasks = new ArrayList<Task>();
		Task task = new Task();
		task.setTask_id(7);
		task.setTask_name("7");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		task = new Task();
		task.setTask_id(8);
		task.setTask_name("8");
		task.setTask_status("ACTIVE");
		task.setTask_priority("HIGH");
		tasks.add(task);
		return tasks;
	}
}
